package com.bzxhh;

import java.util.LinkedList;

public class Test03 {

    public static void main(String[] args) {

        LinkedList<String> linkedList = new LinkedList<>();
        linkedList.addFirst("111");
        linkedList.addFirst("222");
        linkedList.addFirst("333");
        linkedList.addFirst("444");

        System.out.println(linkedList.size());
        System.out.println(linkedList.removeFirst());
        System.out.println(linkedList.getFirst());
        System.out.println(linkedList.getFirst());
        System.out.println(linkedList);

        LinkedList<Integer> list1 = new LinkedList<Integer>();
        LinkedList<Integer> list2 = new LinkedList<Integer>();
        list1.addFirst(1);
        list2 = (LinkedList<Integer>) list1.clone();
        list1.removeFirst();
        System.out.println(list1); //[]
        System.out.println(list2); //[1]

        LinkedList<Integer> list3 = new LinkedList<Integer>();
        LinkedList<Integer> list4 = new LinkedList<Integer>();
        list3.addFirst(1);
        list4 = list3;
        list3.removeFirst();
        System.out.println(list3); //[]
        System.out.println(list4); //[]
    }
}
